package lang_test;


import java.lang.reflect.Field;

public class TestClone implements Cloneable{
    int a;
    double b;

    @Override
    public Object clone(){
        try {
            return super.clone();
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
            return this;
        }
    }

}

class CloneDemo{
    public static void main(String[] args) {
        TestClone x1=new TestClone();
        TestClone x2;

        x1.a=10;
        x1.b=20.98f;
        Field[] fields=x1.getClass().getDeclaredFields();
        System.out.println(x1.getClass().getSuperclass().getName());


        x2=(TestClone)x1.clone();

        System.out.println("x1:"+x1.a+x1.b);
        System.out.println("x2:"+x2.a+x2.b);
    }
}
